<?php

namespace app\silk_eip\controller;

/**
 * NewsController 类
 *
 * @since VER:1.0; DATE:2016-8-29; AUTHOR:SoChishun; EMAIL:14507247@qq.com; DESC:Added.
 */
class NewsController extends AppbaseController {

    function news($cid = 19) {
        $m_doc = new \XWAM\Model\DocumentModel();
        $list=$m_doc->get_paging_list($page, array('where'=>array('category_id'=>$cid),'field'=>'id, title, picture_url, summary, create_time','order'=>'id desc'), array('cid'=>$cid));
        unset($m_doc);
        $m_cat = new \XWAM\Model\DocumentCategoryModel();
        $abreadcrumb = $m_cat->get_parent_list($cid); // 当前分类以及所有父分类列表
        unset($m_cat);
        $this->assign('abreadcrumb', $abreadcrumb);
        $this->assign('list',$list);
        $this->assign('page',$page->show());
        $this->display();
    }

    function news_detail($id = 0) {
        if (!$id) {
            $this->error('参数无效!');
        }
        $m_doc = new \XWAM\Model\DocumentModel();
        $data = $m_doc->find_document($id);
        unset($m_doc);
        $m_cat = new \XWAM\Model\DocumentCategoryModel();
        $abreadcrumb = $m_cat->get_parent_list($data['category_id']); // 当前分类以及所有父分类列表
        unset($m_cat);
        $this->assign('abreadcrumb', $abreadcrumb);
        $this->assign('data', $data);
        $this->display();
    }

}
